﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using Owin;

namespace NFinal.Middleware.Resources4Test
{
    public class Startup
    {
        public void Configuration(IAppBuilder appBuilder)
        {
            Assembly assembly = typeof(Startup).Assembly;
            string name = new AssemblyName(assembly.FullName).Name;
            string xmlConfigFolder =Path.GetDirectoryName(assembly.Location);
            string xmlConfigFileName = Path.Combine(xmlConfigFolder, "Resource.xml");
            var config = new NFinal.Middleware.Resources.ResourcesConfig()
            {
                ResourcesArray = new[] { new Resources.Resources(xmlConfigFileName, assembly) },
                defaultUrl = "/Index.html"
            };
            appBuilder.Use<NFinal.Middleware.Resources.OwinResourcesMiddleware>(config);
        }
    }
}
